<?php
/**
 * 修复权限管理菜单的图标
 */

$host = '113.44.136.17';
$port = 3306;
$database = 'qiandao';
$username = 'qiandao';
$password = 'NGbks3HWx5PhSxDX';

try {
    $pdo = new PDO("mysql:host={$host};port={$port};dbname={$database};charset=utf8mb4", $username, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    echo "=== 修复权限管理菜单图标 ===\n\n";
    
    // 给权限管理菜单添加图标
    $stmt = $pdo->prepare("UPDATE system_menu SET icon = 'layui-icon layui-icon-auz' WHERE id = 9");
    $stmt->execute();
    echo "✓ 已设置权限管理菜单图标\n\n";
    
    // 验证
    $stmt = $pdo->query("SELECT id, title, icon, url FROM system_menu WHERE pid = 0 AND status = 1 ORDER BY sort DESC");
    $menus = $stmt->fetchAll(PDO::FETCH_ASSOC);
    
    echo "=== 所有一级菜单 ===\n";
    foreach ($menus as $menu) {
        $icon = empty($menu['icon']) ? '(无图标)' : $menu['icon'];
        echo "{$menu['title']}: {$icon}\n";
    }
    
    echo "\n=== 完成！===\n";
    
} catch (PDOException $e) {
    echo "数据库错误: " . $e->getMessage() . "\n";
}

